QuickOPC User's Guide and Reference
Errors and Multiple-Element Operations
Development Models > Imperative Programming Model > Error Model in imperative programming > Errors and Multiple-Element Operations

Some methods on the main EasyDAClient or EasyUAClient object operate on multiple elements (such as OPC items) at once, and they also return results individually for each of the input elements. Such methods cannot simply throw an exception when there is a problem with processing one of the elements, because throwing an exception would make it impossible to further process other elements that are not causing errors. In addition, exception handling is very slow, and we need some efficient mechanism for dealing with situations when there may be multiple errors occurring at once.

For this reason, methods that work on multiple elements return an array of results, and each result may have an Exception associated with it. If this exception is a null reference, then there has been no error processing the operation on the element, and other data contained in the result object is valid. When the exception is not a null reference, it contains the actual error.

For multiple-element operations, the element-level exceptions are not wrapped in OpcException or UAException, because there is no need for you to distinguish them from other exception types in the catch statement. If there is an exception inside a multiple-level operation, it is always an exception related to OPC operations. The Exception property of the result object in a multiple-element operation therefore contains what would be the InnerException of the OpcException or UAException thrown for a single-element operation.

Exceptions that are not related to OPC operations, such as argument-checking exceptions, are still thrown directly from the multiple-element operations, i.e. they are not returned in the OperationResult object.

See Also